package com.timoon.component.panel.checkbox;

import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.form.AjaxCheckBox;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.IModel;

/**
 * 复选框面板
 * @author Administrator
 *
 */
public abstract class CheckBoxPanel extends Panel {
	private static final long serialVersionUID = 2460709685265811507L;
	
	/**
	 * 
	 * @param id
	 * @param model		初始化状态
	 */
	public CheckBoxPanel(String id, IModel<Boolean> model) {
		super(id, model);
		// TODO Auto-generated constructor stub
		AjaxCheckBox check=new AjaxCheckBox("checkbox",model){

			@Override
			protected void onUpdate(AjaxRequestTarget arg0) {
				// TODO Auto-generated method stub
				onCheckUpdate(this.getModelObject());
			}
			
		};
		add(check);
	}
	protected abstract void onCheckUpdate(boolean newSelection);
	
}
